#ifndef DLGSETTINGS_H
#define DLGSETTINGS_H

#include <QDialog>
#include <QSettings>
#include "housingdbms.h"

#define HOME_DIR_KEY        "home_dir"
#define DOC_DIR_KEY         "doc_dir"
#define EXPORT_DIR_PATH     "export_dir"
#define AUTO_CONNECT_KEY    "auto_connect"
#define LENDERS_LIST             "lenders_list"
#define LENDERS_FIO_LIST      "lenders_fio_list"

namespace Ui {
    class DlgSettings;
}



class DlgSettings : public QDialog
{
    Q_OBJECT
private:
    Ui::DlgSettings *ui;
protected:
    QSettings   *mp_settings;

    void    write_settings();
    void    read_settings();

    void resizeEvent(QResizeEvent *);
    void showEvent(QShowEvent *);

public:
    explicit DlgSettings(QWidget *parent = 0);
    void    get_housing_settings(HousingSettings &hs);
    bool    is_auto_connect();
    QString get_doc_dirpath();
    QString get_export_dirpath();
    QStringList get_lender_heads();
    QStringList get_lender_heads_fio();
    ~DlgSettings();

private slots:
    void on_btn_browse_dir_clicked();
    void on_btnOk_clicked();
    void on_btnCancel_clicked();
    void on_btn_browse_dir_doc_clicked();
    void on_btn_set_export_dir_clicked();
    void add_lender_item(QString qstr_lender = RUSTR("Укажите должность предствителя наймодателя"),
                                    QString qstr_lender_fio = RUSTR("И.О.Фамилия предствителя наймодателя"));
    void del_lender_item();
    void resize_tables();

};

#endif // DLGSETTINGS_H
